import requests

ipa='http://172.16.0.254:8080'

class LoginApi():

    def denglu(self,uri,data):
        url=f'{ipa}{uri}'
        mdata=data

        r=requests.post(url,data=mdata)
        # print(r.json())
        return r
    #获取token
    def get_token(self,uri,data):
        r=self.denglu(uri,data)
        token = r.json()['Admin-Token']
        # print(token)
        return token


if __name__ == '__main__':
    login=LoginApi()
    login.denglu('/login',{'username':'17513230013','password':'123456'})
    print(login.get_token('/login',{'username':'17513230013','password':'123456'}))
